/*
 * @(#)EommodityController.java
 *
 * Copyright 2011 Xinhua Online, Inc. All rights reserved.
 */

package com.winxuan.channel.controller.commodity;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.winxuan.channel.controller.BaseController;
import com.winxuan.channel.model.object.ChannelResult;
import com.winxuan.channel.service.commodity.EcCommodityService;
import com.winxuan.channel.support.interceptor.PaginationAware;
import com.winxuan.util.pagination.Pagination;

/**
 * EC Commodity Controller
 * @author  HideHai
 * @version 1.0,2011-6-20
 */
@Controller
@RequestMapping(value="/ecommodity")
public class EcCommodityController extends BaseController implements PaginationAware{
	
	@Autowired
	private EcCommodityService ecCommodityService;
	
	@RequestMapping(value="/shopno/{shopNo}/convert",method=RequestMethod.POST)
	public ChannelResult getGoodsNoByShopNo(@RequestParam("shopNo")Integer shopNo){
		ChannelResult channelResult = new ChannelResult();
		Integer goodNo =  ecCommodityService.getGoodsNoByShopNo(shopNo);
		if(goodNo != null){
			channelResult.setSuccess(true);
			channelResult.setResult(goodNo);
		}else{
			channelResult.setSuccess(false);
			channelResult.setResult(null);
			channelResult.setMsg("未找到此店铺编码对应的商品ID");
		}
		return channelResult;
	}

	@Override
	public void setPagination(Pagination pagination) {
		this.pagination = pagination;
	}
	

}

